#include <iostream>
#include <string>
using namespace std;
//Finds the perimeter and the area of a square from given sides;
int main(){
    int a = 0, b = 0;
    int perimeter = 0;
    int area;
    string unit;
    cin>>a>>b>>unit;
    perimeter = 2*(a+b);
    area = a * b;
    cout << "P = "<<perimeter
         <<" " + unit
         <<endl
         <<" S = "<<
         area<<" " + unit
         <<"^2"<<endl;

}
